window.onload = function () {
    var h1 = document.getElementById("newbie-title1")
    var h2 = document.getElementById("newbie-title2")
    var p1 = document.getElementById("inside1")
    var p2 = document.getElementById("inside2")
    var s = document.getElementById("newbie")
    h1.onclick = function () {
        p1.className = "inside-show"
        p2.className = "inside-hide"
        h1.className = "title-show"
        h2.className = "title-hide"
        s.style.height = "467.76px"
    }
    h2.onclick = function () {
        p1.className = "inside-hide"
        p2.className = "inside-show"
        h1.className = "title-hide"
        h2.className = "title-show"
        s.style.height = "600px"
    }
    //显示时间和日期
    var oDt = new Date();
    var sWd = '';
    var iWeekDay = oDt.getDay();
    switch (iWeekDay) {
        case 0:
            sWd = '星期日';
            break;
        case 1:
            sWd = '星期一';
            break;
        case 2:
            sWd = '星期二';
            break;
        case 3:
            sWd = '星期三';
            break;
        case 4:
            sWd = '星期四';
            break;
        case 5:
            sWd = '星期五';
            break;
        case 6:
            sWd = '星期六';
            break;
    }

    var iMonth = parseInt(oDt.getMonth()) + 1;
    document.getElementById('displaydate').innerHTML = '<span>' + oDt.getFullYear() + '年' + iMonth + '月' + oDt.getDate() + '日' + sWd + '</span>';
    window.setInterval(
        function showTime() {
            var oDt = new Date();
            var sTime = '';
            if (oDt.getHours() < 10) {
                sTime += '0' + oDt.getHours() + ':';
            } else {
                sTime += oDt.getHours() + ':';
            }
            if (oDt.getMinutes() < 10) {
                sTime += '0' + oDt.getMinutes() + ':';
            } else {
                sTime += oDt.getMinutes() + ':';
            }
            if (oDt.getSeconds() < 10) {
                sTime += '0' + oDt.getSeconds() + '';
            } else {
                sTime += oDt.getSeconds() + '';
            }
            document.getElementById('displaytime').innerHTML = '<span>' + sTime + '</span>';

        }
        , 1000);
//图片切换
    if (document.getElementById('a1') != null) {
        document.getElementById('a1').onmouseover = function () {
            document.getElementById('badimg').src = 'images/b-ad1.png';
        }
    }
    if (document.getElementById('a2') != null) {
        document.getElementById('a2').onmouseover = function () {
            document.getElementById('badimg').src = 'images/b-ad2.png';
        }
    }
    if (document.getElementById('a3') != null) {
        document.getElementById('a3').onmouseover = function () {
            document.getElementById('badimg').src = 'images/b-ad3.png';
        }
    }
    if (document.getElementById('a4') != null) {
        document.getElementById('a4').onmouseover = function () {
            document.getElementById('badimg').src = 'images/b-ad4.png';
        }
    }
}